/**
 * 将文件转为 base64
 * @param file 文件
 */
export function fileToBase64(file:File) {
  return new Promise<string>((resolve, reject) => {
    const loader = new FileReader();
    loader.onload = () => {
      resolve(loader.result as string);
    };
    loader.onerror = reject;
    loader.onabort = reject;
    loader.readAsDataURL(file);
  });
}